package text;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class client {
    public static void main(String[] args) throws IOException {
        //多次发送数据
        Socket socket = new Socket("127.0.0.1", 10002);
        //获取输出流
        OutputStream os = os = socket.getOutputStream();;
        Scanner sc=new Scanner(System.in);
        while (true) {
            System.out.println("请输入你要发送的信息");
            String s = sc.nextLine();
            if("886".equals(s))
                break;
            os.write(s.getBytes());
        }
        os.close();
        socket.close();
    }
}
